package com.anuo.app.common.utils;


import com.anuo.app.common.globalhandle.AppException;

import java.math.BigDecimal;
import java.util.Date;

public class Assert {
    public static void isEmpty(String value, String message) {
        if (StringUtil.isEmpty(value)) {
            throw new AppException(message);
        }
    }

    public static void isEmpty(int value, String message) {
        if (value == 0) {
            throw new AppException(message);
        }
    }

    public static void isEmpty(BigDecimal value, String message) {
        if (value == null) {
            throw new AppException(message);
        }
    }

    public static void isZero(BigDecimal value, String message) {
        if (value == null || "0".equals(value.toString())) {
            throw new AppException(message);
        }
    }

    public static void isEmpty(Date value, String message) {
        if (value == null) {
            throw new AppException(message);
        }
    }

    public static void isEmpty(Object obj, String message) {
        if (obj == null) {
            throw new AppException(message);
        }
    }
}
